import { Column, Entity } from "typeorm";
import { BaseEntity } from "../../base/entity/base";

@Entity('payment_record', { comment: '支付记录' })
export class PaymentRecordEntity extends BaseEntity {

    @Column({
        dict: ['wxpay', 'alipay', 'bank', 'other'],
        default: 0,
        comment: '支付方式',
    })
    method: string;

    @Column({
        type: 'decimal',
        precision: 10,
        scale: 2,
        comment: '支付金额',
    })
    amount: number;

    @Column({
        comment: '关联订单ID',
        nullable: false,
    })
    orderId: number

    @Column({
        type: 'datetime',
        nullable: true,
        comment: '支付通知时间',
    })
    notifyTime: Date;

    @Column({
        type: 'varchar',
        length: 255,
        comment: '支付用户昵称',
    })
    userName: string;

    @Column({
        type: 'varchar',
        length: 255,
        comment: '支付用户头像',
    })
    userAvatar: string;

    @Column({
        type: 'varchar',
        length: 255,
        comment: '支付用户手机号',
    })
    userPhone: string;

    @Column({
        type: 'enum',
        enum: ['success', 'refund', 'notpay', 'closed', 'payerror'],
        default: 'notpay',
        comment: '状态',
    })
    status: string;
}